home *** CD-ROM | disk | FTP | other *** search
-
- /* C O P Y R I G H T N O T I C E : */
- /* Copyright 1986 Eric Jul and Norm Hutchinson. May not be used for any */
- /* purpose without written permission from the authors. */
-
- /* This source module contains the stuff to dynamically load an object */
- /* from a Ultrix file or from another kernel. */
-
- #include "Kernel/h/system.h"
- #include "Kernel/h/macros.h"
- #include "Kernel/h/assert.h"
- #include "Kernel/h/mmMsgTypes.h"
- #include "Kernel/h/emTypes.h"
- #include "Kernel/h/map.h"
- #include "Kernel/h/emkDefs.h"
-
- GenericReqPtr reqStack;
-
- /************************************************************************/
- GenericReqPtr MakeNewRequest(fTag, fSizeInBytes)
- ReqTag fTag;
- int fSizeInBytes;
- {
- register GenericReqPtr x;
-
- if (NonNULL(reqStack)) {
- x = reqStack;
- reqStack = reqStack->hdr.next;
- x->hdr.rTag = fTag;
- x->hdr.next = (GenericReqPtr) NULL;
- /* assert the maps hdr.reqBy and hdr.wantList are cleared */
- } else {
- x = (GenericReqPtr) malloc(sizeof(GeneralReq));
- x->hdr.rTag = fTag;
- x->hdr.next = (GenericReqPtr) NULL;
- x->hdr.reqBy = Map_Create();
- x->hdr.wantList = Map_Create();
- }
-
- return x;
- }
-
-
- void FreeRequest(fReq)
- register GenericReqPtr fReq;
- {
- assert(Map_Count(fReq->hdr.wantList) == 0);
- if (Map_Count(fReq->hdr.reqBy) > 0) {
- Map_Clear(fReq->hdr.reqBy);
- }
- fReq->hdr.next = reqStack;
- reqStack = fReq;
-
- #ifdef DELETEOFREQ
- Map_Destroy(fReq->hdr.reqBy);
- Map_Destroy(fReq->hdr.wantList);
- free(fReq);
- #endif DELETEOFREQ
- }
-
- /**********************************************************************/
- /* DoCallBack */
- /**********************************************************************/
-
- void DoCallBack(fReq, fOID)
- GenericReqPtr fReq;
- OID fOID;
- /* Perform the call back with the given OID */
- {
- GenericReqPtr oldReq;
- int dummy;
-
- Map_For(fReq->hdr.reqBy, oldReq, dummy)
- Map_Delete(oldReq->hdr.wantList, (int) fReq);
- (*oldReq->hdr.callBack)(oldReq, fOID);
- Map_Next
- }
-
- void RequestInit()
- {
- reqStack = (GenericReqPtr) NULL;
- }
-
-